﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace RegattaStarter
{
    public partial class ChooseFlag : PhoneApplicationPage
    {
        public ChooseFlag()
        {
            InitializeComponent();
            List<string> flags = SettingsMethods.GetFlags(false);
            Uri firstImgUri = new Uri(flags[0], UriKind.Relative);
            firstImg.Source = new System.Windows.Media.Imaging.BitmapImage(firstImgUri);
            Uri secondImgUri = new Uri(flags[1], UriKind.Relative);
            secondImg.Source = new System.Windows.Media.Imaging.BitmapImage(secondImgUri);
            Uri thirdImgUri = new Uri(flags[2], UriKind.Relative);
            thirdImg.Source = new System.Windows.Media.Imaging.BitmapImage(thirdImgUri);
        }

        private void changeFirstFlag(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Flags.xaml?Flagnumber=1", UriKind.Relative));
        }

        private void changeSecondFlag(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Flags.xaml?Flagnumber=2", UriKind.Relative));
        }

        private void changeThirdFlag(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/Flags.xaml?Flagnumber=3", UriKind.Relative));
        }

        private void SaveCustom_click(object sender, EventArgs e)
        {
            SettingsMethods.SaveCustomConfiguration();
            NavigationService.GoBack();
        }
    }
}